<template>
<div>
  <el-form :model="form" :inline="true" label-position="left">
    <el-form-item label="标题" label-width="100px">
      <el-col :span="16">
        <el-input v-model="form.name" autocomplete="off" placeholder="请输入标题" style="width: 220px"></el-input>
      </el-col>
    </el-form-item>
    <el-form-item label="类型" label-width="100px">
      <el-col :span="16">
        <el-select v-model="form.type" placeholder="请选择" style="width: 220px">
          <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
          </el-option>
        </el-select>
      </el-col>
    </el-form-item>
    <el-form-item label="内容" label-width="100px">
      <el-col :span="16">
        <el-input v-model="form.content" autocomplete="off" placeholder="请输入内容" style="width: 220px" type="textarea"
                  :autosize="{ minRows: 2, maxRows: 4}"></el-input>
      </el-col>
    </el-form-item>
    <el-form-item label="姓名" label-width="100px">
      <el-col :span="16">
        <el-input v-model="form.username" autocomplete="off" placeholder="请输入姓名" style="width: 220px" ></el-input>
      </el-col>
    </el-form-item>
    <el-form-item label="手机" label-width="100px">
      <el-col :span="16">
        <el-input v-model="form.phone" autocomplete="off" placeholder="请输入手机" style="width: 220px"maxlength="11"></el-input>
      </el-col>
    </el-form-item>

  </el-form>
  <div slot="footer" class="dialog-footer">
    <el-button @click="cancel">取 消</el-button>
    <el-button type="primary" @click="solveOk">确 定</el-button>
  </div>
</div>
</template>

<script>
import request from "@/utils/request";

export default {
  name: "Complaint",
  data(){
    return{
      form:{
        id:"",
        name:"",
        type:"",
        content:"",
        username:"",
        phone:"",
        solve:"",
        relf:""
      },
      options: [{
        value: '1',
        label: '社区物业'
      }, {
        value: '2',
        label: '社区环境'
      }, {
        value: '3',
        label: '社区安全'
      }, {
        value: '4',
        label: '其他'
      }],
    };
  },
  methods:{
    cancel(){
      this.form=[]
    },
    solveOk(){
      this.form.solve=1
      request.post("complaint",this.form).then(res =>{
        if (res.code=="200"){
          this.$message.success("新增成功")
          this.form={}
        }else {
          this.$message.error("新增失败")
        }
      })
    }
  }
}
</script>

<style scoped>

</style>